<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>个人信息</title>
	<link rel="stylesheet" href="../statics/bootstrap-3.3.0/css/bootstrap.css">
	<link rel="stylesheet" href="../statics/jquery-ui-1.12.1/jquery-ui.css">
	<link rel="stylesheet" href="../statics/jquery-ui-1.12.1/jquery-ui.theme.css">
	<link rel="stylesheet" href="../statics/css/style.css">
	<script src="../statics/jquery-1.12.4/jquery-1.12.4.js"></script>
</head>
<body>
	<div id="header"></div>
	<div class="container" style="position: relative; transform: translate(0, 0)">
		<div class="col-md-9" style="float: left">
			<div class="col-md-12 r1" style="background-color: #e4e4e4; height: 40px">
				<div class="col-md-6" style="margin-top: 5px">
					<B style="color: #c4c4c4; font-size: 20px">我的信息</B>
				</div>
			</div>
			<div class="col-md-12 r2"
				style="background-color: #f9f9f9; padding-top: 15px; padding-bottom: 15px; margin-bottom: 20px">
				<div class="col-md-2" style="padding-left: 0px; padding-right: 0px;">
					<img id="ProfileImage" src="photo" width="128px" height="128px">
				</div>
				<p id="userIdHidden" hidden></p>
				<div class="col-md-10">
					<div class="col-md-12" style="height: 60px;">
						<h3>
							<B id="Bname"></B>
						</h3>
					</div>
					<div class="col-md-2" style="padding-right: 0px">
						<p style="color: #666666; height: 20px">
							<B>邮箱：</B>
						</p>
						<p style="color: #666666; height: 20px">
							<B>性别：</B>
						</p>
					</div>
					<div class="col-md-4" style="padding-left: 0px">
						<p id="email" style="color: #666666; height: 20px"></p>
						<p id="gender" style="color: #666666; height: 20px"></p>
					</div>
					<div class="col-md-2" style="padding-right: 0px">
						<p style="color: #666666; height: 20px">
							<B>手机号：</B>
						</p>
					</div>
					<div class="col-md-3" style="padding-left: 0px">
						<p id="mobile" style="color: #666666; height: 20px"></p>
					</div>
					<div class="col-md-3">
						<a href="/user/userEdit.html">修改个人资料</a>
					</div>
				</div>
			</div>

			<div class="col-md-12 r1" style="background-color: #e4e4e4; height: 40px">
				<div class="col-md-6" style="margin-top: 5px">
					<B style="color: #c4c4c4; font-size: 20px">我的订单</B>
				</div>
			</div>
			<div class="col-md-12 r2"
				 style="background-color: #f9f9f9; padding-top: 15px; padding-bottom: 15px; margin-bottom: 20px;">
				<div class="col-md-12 r" style="background-color: #ffffff;">
					<p></p>
					<p id="myOrder" style="color: #c4c4c4; font-size: 20px; margin-bottom: 0px;" align="center">
						<B>我所有的订单</B>
					</p>


					<div class="col-md-12 column" style="overflow-y: auto; height: 280px;">
						<table id="orderTable" class="table table-hover">
							<tr></tr>
							<!--								<tr style="color: #666666">-->
							<!--									<td style="width: 90px"><a target="_blank"-->
							<!--											href="/wzh-secondshop/user/orderInfo?orderId=${order.id}">${order.id}</a>-->
							<!--									</td>-->
							<!--									<td style="width: 100px">${order.seller}</td>-->
							<!--									<td style="width: 140px">${order.goodName}</td>-->
							<!--									<td style="width: 70px">${order.money}</td>-->
							<!--									<td style="width: 200px">${order.submitDate}</td>-->
							<!--									<td>${order.statusId == 2 ? "交易中":"交易完成"}</td>-->
							<!--								</tr>-->
						</table>
					</div>

					<!--					<p style="color: #c4c4c4; font-size: 20px; margin-bottom: 0px;" align="center">-->
					<!--						<B>我所有的聊天记录</B>-->
					<!--					</p>-->
					<!--					<div class="col-md-12" style="margin-top: 50px;" align="center">-->
					<!--						<p></p>-->
					<!--						<img src="../statics/image/logo/yihan.png" width="40%" ; height="200px;">-->
					<!--						<p style="color: #c4c4c4; font-size: 20px">你还没有聊天记录哦！</p>-->
					<!--					</div>-->
					<!--					<div class="col-md-12 column" style="padding-left: 15px;">-->
					<!--						<table class="table" style="margin-bottom: 0px">-->
					<!--							<thead>-->
					<!--							<tr style="color: #666666">-->
					<!--								<th style="width: 100px">对方昵称</th>-->
					<!--							</tr>-->
					<!--							</thead>-->
					<!--						</table>-->
					<!--					</div>-->
					<!--					<div class="col-md-12 column" style="overflow-y: auto; height: 280px;">-->
					<!--						<table class="table table-hover">-->
					<!--							<tbody>-->
					<!--							<tr style="color: #666666">-->
					<!--								<td style="width: 90px"><a target="_blank"-->
					<!--										 href="/wzh-secondshop/user/orderInfo?orderId=${order.id}">${user.nick_name}</a>-->
					<!--								</td>-->
					<!--							</tr>-->
					<!--							</tbody>-->
					<!--						</table>-->
					<!--					</div>-->
				</div>
			</div>

			<div class="col-md-12 r1" style="background-color: #e4e4e4; height: 40px">
				<div class="col-md-6" style="margin-top: 5px">
					<B style="color: #c4c4c4; font-size: 20px">我的物品</B>
				</div>
			</div>
			<div class="col-md-12 r2"
				style="background-color: #f9f9f9; padding-top: 15px; padding-bottom: 15px; margin-bottom: 20px;">
				<div  class="col-md-12 r" style="background-color: #ffffff;">
					<p id="myGood" style="color: #c4c4c4; font-size: 20px; margin-bottom: 0px;" align="center">
						<B>我发布的物品</B>
					</p>
<!--					<div  className='col-md-12' style='margin-top: 50px;' align='center'>-->

<!--						<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>-->
<!--						<p style='color: #c4c4c4; font-size: 20px'>你还没有发布物品哦！</p>-->
<!--					</div>-->
					<div class="col-md-12 column" style="overflow-y: auto; height: 280px;">
						<table id="goodTable" class="table table-hover">
								<tr></tr>
						</table>
					</div>
<!--					<div class="col-md-12 column" style="overflow-y: auto; height: 280px;">-->
<!--						<table class="table table-hover">-->
<!--							<tbody>-->
<!--								<tr style="color: #666666">-->
<!--									<td style="width: 102px"><a target="_blank"-->
<!--											href="/wzh-secondshop/goods/goodInfo?goodId=${good.id}">${good.id}</a></td>-->
<!--									<td style="width: 227px">${good.name}</td>-->
<!--									<td style="width: 260px">${good.uploadDate}</td>-->
<!--									<td>${good.statusId == 0 ? "已下架":"在售"}</td>-->
<!--								</tr>-->
<!--							</tbody>-->
<!--						</table>-->
<!--					</div>-->
				</div>
			</div>

			<div class="col-md-12 r1" style="background-color: #e4e4e4; height: 40px">
				<div class="col-md-6" style="margin-top: 5px">
					<B style="color: #c4c4c4; font-size: 20px">我收藏的物品</B>
				</div>
			</div>
			<div class="col-md-12 r2"
				 style="background-color: #f9f9f9; padding-top: 15px; padding-bottom: 15px; margin-bottom: 20px;">
				<div class="col-md-12 r" style="background-color: #ffffff;">
					<p></p>
					<p id="myCollection" style="color: #c4c4c4; font-size: 20px; margin-bottom: 0px;" align="center">
						<B>我收藏的物品</B>
					</p>
<!--					<div class="col-md-12" style="margin-top: 50px;" align="center">-->
<!--						<p></p>-->
<!--						<img src="../statics/image/logo/yihan.png" width="40%" ; height="222px;">-->
<!--						<p style="color: #c4c4c4; font-size: 20px">你还没有收藏物品哦！</p>-->
<!--					</div>-->
<!--					<div class="col-md-12 column" style="padding-left: 15px;">-->
<!--						<table class="table" style="margin-bottom: 0px">-->
<!--							<thead>-->
<!--							<tr style="color: #666666">-->
<!--								<th style="width: 102px">编号</th>-->
<!--								<th style="width: 200px">标题</th>-->
<!--								<th style="width: 200px">发布时间</th>-->
<!--								<th style="width: 100px">状态</th>-->
<!--								<th>操作</th>-->
<!--							</tr>-->
<!--							</thead>-->
<!--						</table>-->
<!--					</div>-->
					<div class="col-md-12 column" style="overflow-y: auto; height: 280px;">
						<table id="collectionTable" class="table table-hover">
							<tr></tr>
							<!-- <c:forEach var="collect" items="${collects}"> -->
<!--							<tr style="color: #666666">-->
<!--								<td style="width: 102px"><a target="_blank"-->
<!--															href="/wzh-secondshop/goods/goodInfo?goodId=${collect.good.id}">${collect.good.id}</a>-->
<!--								</td>-->
<!--								<td style="width: 200px">${collect.good.name}</td>-->
<!--								<td style="width: 200px">${collect.good.uploadDate}</td>-->
<!--								<td style="width: 100px">${collect.good.statusId == 0 ? "已下架":"在售"}</td>-->
<!--								<td><a onclick="deleteCollect(${collect.id})">删除</a></td>-->
<!--							</tr>-->

						</table>
					</div>
				</div>
			</div>
		</div>
		
		
		<div id="re-bar" class="col-md-3" style="padding-left: 0px; padding-right: 0px;">
<!--			<div class="col-md-12 r1"-->
<!--				style="background-color: #e4e4e4; height: 40px; padding-left: 0px; padding-right: 0px;">-->
<!--				<div id="review-bar" class="col-md-6 rev1-bar" align="center" onclick="reviewButton()">-->
<!--					<B style="font-size: 16px; color: #c4c4c4">收到的评论</B>-->
<!--				</div>-->
<!--				<div id="reply-bar" class="col-md-6 rev2-bar" align="center" onclick="replyButton()">-->
<!--					<B style="font-size: 16px; color: #c4c4c4">收到的回复</B>-->
<!--				</div>-->
<!--			</div>-->
			<div class="col-md-12 r2" style="background-color: #f9f9f9; padding-bottom: 15px">
<!--				<div id="review-body" class="col-md-12 r3"-->
<!--					style="display: none; overflow-y: auto; height: 585px; background-color: #ffffff; padding-left: 5px; padding-right: 5px; padding-top: 5px; padding-bottom: 15px;">-->
<!--					<div class="col-md-12" align="center" style="background-color: #ffffff; margin-top: 150px">-->
<!--						<img src="../statics/image/logo/yihan.png" width="95%" ; height="170px;">-->
<!--						<p style="color: #c4c4c4; font-size: 16px">抱歉，暂无评论消息！</p>-->
<!--					</div>-->
<!--					<a target="_blank" href="/wzh-secondshop/user/review?goodId=${review.goodId}&reviewId=${review.id}">-->
<!--						<div class="col-md-12 rev" style="padding-left: 0px; padding-right: 0px; margin-bottom: 5px;">-->
<!--							<div class="col-md-11">-->
<!--								<p></p>-->
<!--								<p style="color: #c4c4c4;">${review.uploadDate}</p>-->
<!--								<p>-->
<!--									<B style="color: #2aabd2">${review.fromUser}</B>&nbsp;评论了你的物品-->
<!--								</p>-->
<!--							</div>-->
<!--							<div class="col-md-1" style="padding-right: 0px">-->
<!--								<img src="../statics/image/logo/new_message.png" height="30px" width="25px"-->
<!--									align="right">-->
<!--							</div>-->
<!--						</div>-->
<!--					</a>-->
<!--				</div>-->
<!--				<div id="reply-body" class="col-md-12 r3"-->
<!--					style="display: none; overflow-y: auto; height: 585px; background-color: #ffffff; padding-left: 5px; padding-right: 5px; padding-top: 5px; padding-bottom: 15px;">-->
<!--					<div class="col-md-12" align="center" style="background-color: #ffffff; margin-top: 150px">-->
<!--						<img src="../statics/image/logo/yihan.png" width="95%" ; height="170px;">-->
<!--						<p style="color: #c4c4c4; font-size: 16px">抱歉，暂无回复消息！</p>-->
<!--					</div>-->
<!--					<a target="_blank" href="/wzh-secondshop/user/reply?reviewId=${reply.reviewId}&replyId=${reply.id}">-->
<!--						<div class="col-md-12 rev" style="padding-left: 0px; padding-right: 0px; margin-bottom: 5px;">-->
<!--							<div class="col-md-11">-->
<!--								<p></p>-->
<!--								<p style="color: #c4c4c4;">${reply.uploadDate}</p>-->
<!--								<p>-->
<!--									<B style="color: #2aabd2">${reply.fromUser}</B>&nbsp;回复了你的消息-->
<!--								</p>-->
<!--							</div>-->
<!--							<div class="col-md-1" style="padding-right: 0px">-->
<!--								<img src="../statics/image/logo/new_message.png" height="30px" width="25px"-->
<!--									align="right">-->
<!--							</div>-->
<!--						</div>-->
<!--					</a>-->
<!--				</div>-->
				
				<!--卖出的商品-->
				<div id="adv-bar" class="col-md-12" style="margin-top: 5px; padding: 0px;">
					<div class="col-md-12" align="center">
						<B style="font-size: 16px; color: #c4c4c4">卖出的物品</B>
					</div>
					<div class="col-md-12"  id="orderBox"   
						style="overflow-y: auto; height: 450px; padding: 5px; background-color: #ffffff;">
<!--						<div class="col-md-12" align="center" style="margin-top: 150px">-->
<!--							<img src="../statics/image/logo/yihan.png" width="95%" ; height="170px;">-->
<!--							<p style="color: #c4c4c4; font-size: 16px">抱歉，暂未卖出物品！</p>-->
<!--						</div>-->
						
						
<!--						<a href="/wzh-secondshop/user/sellerInfo?orderId=${sellGood.id}">-->
<!--							<div class="col-md-12 rev" style="padding: 10px; margin-bottom: 5px;">-->
<!--								<div class="col-md-11" style="padding: 0px;">-->
<!--									<p></p>-->
<!--									<p style="color: #c4c4c4;">${sellGood.submitDate}</p>-->
<!--									<p>-->
<!--										<B style="color: #2aabd2">${sellGood.customer}</B>&nbsp;购买了你的物品&nbsp;<B-->
<!--											style="color: #2aabd2">${sellGood.goodName}</B>-->
<!--									</p>-->
<!--								</div>-->
<!--							</div>-->
<!--						</a>-->
						
						
					</div>
				</div>
				
			</div>
		</div>
	</div>
	<!--footer栏-->
	<div id="footer"></div>
	<script>
		$("#header").load("../home/header.html");
		$("#footer").load("../home/footer.html");
	</script>
	<script>

		function reviewButton() {
			if (document.getElementById("review-body").style.display === "none") {
				document.getElementById("review-bar").className = "col-md-12 rev-bar";
				$("#reply-bar").slideUp();
				$("#review-body").slideDown();
				$("#adv-bar").slideUp();
			} else {
				document.getElementById("review-bar").className = "col-md-6 rev1-bar";
				$("#reply-bar").slideDown();
				$("#review-body").slideUp();
				$("#adv-bar").slideDown();
			}
		}
		function replyButton() {
			if (document.getElementById("reply-body").style.display === "none") {
				document.getElementById("reply-bar").className = "col-md-12 rev-bar";
				document.getElementById("review-bar").style.display = "none";
				$("#reply-body").slideDown();
				$("#adv-bar").slideUp();
			} else {
				document.getElementById("reply-bar").className = "col-md-6 rev2-bar";
				$("#review-bar").slideDown();
				$("#reply-body").slideUp();
				$("#adv-bar").slideDown();
			}
		}
	</script>
	<script>
		var bar_width = document.getElementById("re-bar").scrollWidth;
		$(function () {
			$(window).scroll(function () {
				if ($(document).scrollTop() >= 20) {
					$("#re-bar").css({
						"position": "fixed",
						"top": 50 + $(document).scrollTop() + "px",
						"width": bar_width,
						"right": 15
					});
				} else {
					$("#re-bar").css({
						"position": "fixed",
						"top": 70 + "px",
						"width": bar_width,
						"right": 15
					});
				}
			})
		})
	</script>
	<script src="../statics/bootstrap-3.3.0/js/bootstrap.js"></script>
	<script src="../statics/jquery-ui-1.12.1/jquery-ui.js"></script>
	<script src="../statics/jquery-ui-1.12.1/datepicker-zh-CN.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<script type="text/javascript">
	<!--进入修改页前从session获取用户原信息并填入输入框-->
	function ajax_send(func){
		$.ajax({
			type:"POST",
			url:"/user/preInfo",
			contentType: "application/json;charset=utf-8",
			data:JSON.stringify(123),
			success:function(data){

				if(data.data.sex == 0){
					var sex = "女"
				}else{
					var sex = "男"
				}
				$('#userIdHidden').html(data.data.id);
				$('#Bname').html(data.data.nickName);
				$('#name').html(data.data.nickName);
				$('#gender').html(sex);
				$('#mobile').html(data.data.phoneNumber);
				$('#email').html(data.data.email);
				$('#oldEmail').html(data.data.email);
				$('#ProfileImage').attr("src",  "https://yilutangping.oss-cn-shenzhen.aliyuncs.com/userProfileImage/" + data.data.picture);
				func.call(this,data);
			}
		});
	}

	function allOrder(){
		$.ajax({
			type: "POST",
			url: "/user/preInfo",
			contentType: "application/json;charset=utf-8",
			data: JSON.stringify(123),
			success: function (infoData) {
				var userIdhidden = infoData.data.id;
				var url = "/order/customerId/" + userIdhidden;
				$.ajax({
					url: url,
					type: "GET",
					dataType: "json",
					contentType: "application/json;charset=utf-8",
					success: function (data) {
						console.log(data.data)
						if (data.data.length > 0) {
							$("#myOrder").after("<div className='col-md-12 column' style='padding-left: 15px;'> " +
									"<table className='table' style='margin-bottom: 0px'>" +
									" <thead> " +
									"<tr style='color: #666666'> " +
									"<th style='width: 90px'>订单编号</th>" +
									" <th style='width: 100px'>卖家</th>" +
									" <th style='width: 140px'>物品名称</th>" +
									" <th style='width: 70px'>金额</th> " +
									"<th style='width: 200px'>提交时间</th> " +
									"<th>订单状态</th>" +
									" </tr>" +
									" </thead> " +
									"</table>" +
									"</div>");
							var i;
							for (i = 0; i < data.data.length; i++) {

								$("#orderTable tr:last").after("<tr id='orderid" + data.data[i].id.toString() + "'><td style='width: 90px'>" + data.data[i].id + "</td></tr>");
								$("#orderid" + data.data[i].id + " td:last").after("<td style='width: 100px'>" + data.data[i].seller + "</td>");
								// $("#orderid" + data.data[i].id + " td:last").after("<td style='width: 10%'>" + data.data[i].goodId + "</td>");
								$("#orderid" + data.data[i].id + " td:last").after("<td style='width: 140px'><a href='/user/orderInfo.html?orderId="+data.data[i].id+"'>"+data.data[i].goodName+"</a></td>");
								$("#orderid" + data.data[i].id + " td:last").after("<td style='width: 70px'>" + data.data[i].money + "</td>");
								// $("td:last").after("<td style='width: 18%'>" + data.data[i].submitDate.substr(0,data.data[i].createDate.length-10) + "</td>");
								$("#orderid" + data.data[i].id + " td:last").after("<td style='width: 200px'>" + data.data[i].submitDate + "</td>");
								$("#orderid" + data.data[i].id + " td:last").after("<td></td>");
								if (data.data[i].status == 1) {
									$("#orderid" + data.data[i].id + " td:last").append("交易中");
								}
								if (data.data[i].status == 2) {
									$("#orderid" + data.data[i].id + " td:last").append("交易完成");
								}
								if (data.data[i].status == 3) {
									$("#orderid" + data.data[i].id + " td:last").append("交易取消");
								}
							}
						}
						else{
							$('#myOrder').after("<div className='col-md-12' style='margin-top: 50px;' align='center'>" +
									"<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>" +
									"<p style='color: #c4c4c4; font-size: 20px'>你还没有订单哦！</p>" +
									"</div>");
						}
					}
				});
			}
		})
	}

	function allCollection(){
		$.ajax({
			type: "POST",
			url: "/user/preInfo",
			contentType: "application/json;charset=utf-8",
			data: JSON.stringify(123),
			success: function (infoData) {
				var userIdhidden = infoData.data.id;
				var url = "/goods/findAllCollection/" + userIdhidden;
				$.ajax({
					url: url,
					type: "GET",
					dataType: "json",
					contentType: "application/json;charset=utf-8",
					success: function (collection) {
						console.log(collection.data)
						if (collection.data.length > 0) {
							$("#myCollection").after("<div id='collectionBar' className='col-md-12 column' style='padding-left: 15px;'> " +
									"<table className='table' style='margin-bottom: 0px'>" +
									" <thead> " +
									"<tr style='color: #666666'>" +
									"<th style='width: 90px'>编号</th>" +
									"<th style='width: 180px'>标题</th>" +
									"<th style='width: 220px'>发布时间</th>" +
									"<th style='width: 120px'>状态</th>" +
									"<th style='width: 80px'>操作</th>" +
									"</tr>" +
									" </thead> " +
									"</table>" +
									"</div>");
							var i;
							console.log(collection.data)
							for (i = 0; i < collection.data.length; i++) {
								$.ajax({
									url: "/goods/findById/" + collection.data[i].goodsId,
									type: "GET",
									dataType: "json",
									contentType: "application/json;charset=utf-8",
									success:function(good){
										$("#collectionTable tr:last").after("<tr id='collectionid" + good.data.id.toString() + "' style='color: #666666'><td style='width: 60px'>" + good.data.id + "</td></tr>");
										$("#collectionid" + good.data.id + " td:last").after("<td style='width: 150px'><a href='/goods/goodInfo.html?goodsId=" + good.data.id + "'>" + good.data.title + "</a></td>");
										$("#collectionid" + good.data.id + " td:last").after("<td style='width: 190px'>" + good.data.createDate + "</td>");
										$("#collectionid" + good.data.id + " td:last").after("<td style='width: 100px'></td>");
										if (good.data.saleState == 0) {
											$("#collectionid" + good.data.id + " td:last").append("销售中");
										}
										if (good.data.saleState == 1) {
											$("#collectionid" + good.data.id + " td:last").append("已卖出");
										}
										if (good.data.saleState == 2) {
											$("#collectionid" + good.data.id + " td:last").append("下架");
										}
										$("#collectionid" + good.data.id + " td:last").after("<td style='width: 100px'></td>");
										// $("#goodid" + good.data[i].id + " td:last").append("<a onClick=" + "deleteGood(" + good.data.id.toString() + ")>删除 </a>");
										$("#collectionid" + good.data.id + " td:last").append("<a onClick=" + "deleteCollection(" + good.data.id + "," + userIdhidden + ")>取消收藏 </a>");
									}
								});

							}
						}
						else{
							$('#myCollection').after("<div className='col-md-12' style='margin-top: 50px;' align='center'>" +
									"<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>" +
									"<p style='color: #c4c4c4; font-size: 20px'>你还没有收藏物品哦！</p>" +
									"</div>");
						}
					}
				});
			}
		})
	}

	function allGood(){
		$.ajax({
			type: "POST",
			url: "/user/preInfo",
			contentType: "application/json;charset=utf-8",
			data: JSON.stringify(123),
			success: function (infoData) {
				var userIdhidden = infoData.data.id;
				$.ajax({
					url: "/goods/findByUserId/" + userIdhidden,
					type: "GET",
					contentType: "application/json;charset=utf-8",
					success: function (good) {
						if (good.data.length > 0) {
							$("#myGood").after("<div id='goodBar' className='col-md-12 column' style='padding-left: 15px;'>" +
									"<table className='table' style='margin-bottom: 0px'>" +
									"<thead>" +
									"<tr style='color: #666666'>" +
									"<th style='width: 90px'>编号</th>" +
									"<th style='width: 180px'>标题</th>" +
									"<th style='width: 220px'>发布时间</th>" +
									"<th style='width: 120px'>状态</th>" +
									"<th style='width: 80px'>操作</th>" +
									"</tr>" +
									"</thead>" +
									"</table>" +
									"</div>");
							var i;
							for (i = 0; i < good.data.length; i++) {
								var goodId = good.data[i].goodId
								$("#goodTable tr:last").after("<tr id='goodid" + good.data[i].id.toString() + "' style='color: #666666'><td style='width: 50px'>" + good.data[i].id + "</td></tr>");
								$("#goodid" + good.data[i].id + " td:last").after("<td style='width: 150px'><a href='/goods/goodInfo.html?goodsId=" + good.data[i].id + "'>" + good.data[i].title + "</a></td>");
								$("#goodid" + good.data[i].id + " td:last").after("<td style='width: 200px'>" + good.data[i].createDate.substr(0, good.data[i].createDate.length - 10) + "</td>");
								$("#goodid" + good.data[i].id + " td:last").after("<td style='width: 100px'></td>");
								if (good.data[i].saleState == 0) {
									$("#goodid" + good.data[i].id + " td:last").append("销售中");
								}
								if (good.data[i].saleState == 1) {
									$("#goodid" + good.data[i].id + " td:last").append("已卖出");
								}
								if (good.data[i].saleState == 2) {
									$("#goodid" + good.data[i].id + " td:last").append("下架");
								}
								$("#goodid" + good.data[i].id + " td:last").after("<td style='width: 100px'></td>");
								// $("#goodid" + good.data[i][i].id + " td:last").append("<a onClick=" + "deleteGood(" + good.data[i].id.toString() + ")>删除 </a>");
								$("#goodid" + good.data[i].id + " td:last").append("<a onClick=" + "deleteGood(" + good.data[i].id + ")>删除 </a>");
							}
						}
						else{
							$('#myGood').after("<div className='col-md-12' style='margin-top: 50px;' align='center'>" +
									"<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>" +
									"<p style='color: #c4c4c4; font-size: 20px'>你还没有发布物品哦！</p>" +
									"</div>");
						}
					}
				});
			}
		})
	}
	//一种自动调用ajax的方法
	(function(){
		ajax_send(function(res){
		});
		allOrder(function(res){
		});
		allGood(function(res){
		});
		allCollection(function(res){
		});
	})();

	function deleteGood(goodId) {
		Swal.fire({
			type: 'warning', // 弹框类型
			title: '提示', //标题
			text: "确定要删除此商品吗", //显示内容

			confirmButtonColor: '#3085d6',// 确定按钮的 颜色
			confirmButtonText: '确定',// 确定按钮的 文字
			showCancelButton: true, // 是否显示取消按钮
			cancelButtonColor: '#d33', // 取消按钮的 颜色
			cancelButtonText: "取消", // 取消按钮的 文字

			focusCancel: true, // 是否聚焦 取消按钮
			reverseButtons: false  // 是否 反转 两个按钮的位置 默认是  左边 确定  右边 取消
		}).then((isConfirm) => {
			try {
				//判断 是否 点击的 确定按钮
				console.log("goodID:" + goodId)
				console.log(typeof(goodId))
				if (isConfirm.value) {
					var data = {
						// "id": goodId
						"goodsID": goodId
					};
					$.ajax({
						// url: "/admin/goodDelete",
						url: "/goods/delete",
						type: "POST",
						// type: "GET",
						// dataType: "json",
						// contentType: "application/json;charset=utf-8",
						data: data,
						success: function (data) {
							$("#goodid" + goodId.toString()).remove();

							if($("#goodTable").find("tr").length<=1){
								$("#goodBar").remove();
								$('#myGood').after("<div className='col-md-12' style='margin-top: 50px;' align='center'>" +
										"<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>" +
										"<p style='color: #c4c4c4; font-size: 20px'>你还没有发布物品哦！</p>" +
										"</div>");
							}
							Swal.fire("成功", data.message, "success");
						}
					})
				}
			} catch (e) {
				alert(e);
			}
		});
	}

	function deleteCollection(goodId,userId) {
		Swal.fire({
			type: 'warning', // 弹框类型
			title: '提示', //标题
			text: "确定要删除此商品吗", //显示内容

			confirmButtonColor: '#3085d6',// 确定按钮的 颜色
			confirmButtonText: '确定',// 确定按钮的 文字
			showCancelButton: true, // 是否显示取消按钮
			cancelButtonColor: '#d33', // 取消按钮的 颜色
			cancelButtonText: "取消", // 取消按钮的 文字

			focusCancel: true, // 是否聚焦 取消按钮
			reverseButtons: false  // 是否 反转 两个按钮的位置 默认是  左边 确定  右边 取消
		}).then((isConfirm) => {
			try {
				//判断 是否 点击的 确定按钮
				console.log("goodID:" + goodId)
				console.log(typeof(goodId))
				if (isConfirm.value) {
					$.ajax({
						url: "/goods/cancelCollect/" + userId + "/" + goodId,
						type: "GET",
						// dataType: "json",
						// contentType: "application/json;charset=utf-8",
						success: function (data) {
							$("#collectionid" + goodId.toString()).remove();

							if($("#collectionTable").find("tr").length<=1){
								$("#collectionBar").remove();
								$('#myCollection').after("<div className='col-md-12' style='margin-top: 50px;' align='center'>" +
										"<img src='../statics/image/logo/yihan.png' width='40%' ; height='222px;'>" +
										"<p style='color: #c4c4c4; font-size: 20px'>你还没有收藏物品哦！</p>" +
										"</div>");
							}
							Swal.fire("成功", data.message, "success");
						}
					})
				}
			} catch (e) {
				alert(e);
			}
		});
	}

</script>
<!--右侧订单栏目数据获取-->
	<script type="text/javascript">

		$(function (){
			let userId ="";
			let url = "";
			let phoneNum = "";
			// 获取用户订单
			$.ajax({
				url: "/user/preInfo",
				type: "POST",
				contentType: "application/json;charset=utf-8",
				data: JSON.stringify(123),
				success:function (data){
					userId = data.data.id;
					phoneNum = data.data.phoneNum;
					url = "/order/sellerId/"+userId;
					getOrder(phoneNum);
				}
			});

			function getOrder(phoneNum){
				$.ajax({
					url : url,
					type: "GET",
					data: "",
					contentType: "application/json;charset=utf-8",
					success:function (result){
						addOrderBox(result.data, phoneNum);
					}
				});
			}

			function addOrderBox(result){
				if (result == null || result == ''){
					$("#orderBox").append(
							"<div class='col-md-12' align='center' style='margin-top: 150px'>" +
							"<img src='../statics/image/logo/yihan.png' width='95%'; height='170px';>" +
							"<p style='color: #c4c4c4'; font-size: 16px>抱歉，暂未卖出物品！</p>" +
							"</div>"
					)
				} else {
					$.each(result,function (index, obj){
						$.ajax({
							url : "/user/preInfo",
							type: "POST",
							contentType: "application/json;charset=utf-8",
							data: JSON.stringify(123),
							success:function (result){
								phoneNum = result.data.phoneNumber;
								$("#orderBox").append(
										"<a href='/user/sellerInfo.html?orderId=" +obj['id']+ "&sellerId="+obj['sellerId'] + "'>"+
										"<div class='col-md-12 rev' style='padding: 10px; margin-bottom: 5px;' >" +
										"<div class='col-md-11' style='padding: 0px;'>" +
										"<p></p>"+
										"<p style='color: #c4c4c4;'>" + obj['submitDate'] + "</p>" +
										"<p>" +
										"<B style='color: #2aabd2'>" + obj['customer'] + "</B>"+ "&nbsp;购买了你的物品&nbsp;"+
										"<B style='color: #2aabd2'>" + obj['goodName'] + "</B><br>" +
										"&nbsp;对方联系方式为："+
										"<B style='color: #2aabd2'>" + phoneNum + "</B>" +
										"</p>" +
										"</div>" +
										"</div>" +
										"</a>"
								)
							}
						});

					})
				}
			}
		});

	</script>
</body>
</html>
